package com.mzjf;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Germmy on 2018/7/4.
 */
@RestController
public class HelloController {

    @RequestMapping(value = "/hello",method = RequestMethod.POST)
//    @LogAnnotation(targetType = "hello", action = "print", remark = "Just打个招呼")
    public  String sayHello(){
        System.out.println("say hello...");
        return  "i am liudehua";
    }


    @RequestMapping(value = "/allowCors",method = RequestMethod.POST)
    public  String allowCors(){
        System.out.println("allowCors...");

//        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
//        User user = (User) request.getSession().getAttribute("user");



        return  "i allow cors";
    }




}
